#include <stdio.h>
int main()
{
    char tell[12];
    scanf("%s", tell);
    int arr[10];
    int index[12];
    int a[10] = { 0 }; 
    for (int i = 0; i < 11; i++) a[tell[i] - '0'] = 1;
    int num_ = 0;          
    for (int i = 9; i >= 0; i--) if (a[i]) arr[num_++] = i; 
    for (int i = 0; i < 11; i++)
    {
        int n = tell[i] - '0';
        int k;         
        for (k = 0; k < 10; k++)
        {
            if (n == arr[k]) break;   
        }
        index[i] = k;
    }
    
    printf("int[] arr = new int[]{");
    printf("%d", arr[0]);
    for (int i = 1; i < num_; i++)
    {
        printf(",%d", arr[i]);
    }
    printf("};\n");
    printf("int[] index = new int[]{");
    printf("%d", index[0]);
    for (int i = 1; i < 11; i++)
    {
        printf(",%d", index[i]);
    }
    printf("};\n");
    return 0;
}